<template>
  <div class="iu-nav-bar" :class="{ 'iu-hairline--bottom': border }">
    <div class="iu-nav-bar-content">
      <div class="iu-nav-bar-left">
        <slot name="left"></slot>
      </div>
      <div class="iu-nav-bar-title" :class="{ 'iu-ellipsis': ellipsis }">
        <slot name="title"></slot>
      </div>
      <div class="iu-nav-bar-right">
        <slot name="right"></slot>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "iu-header",
  data() {
    return {};
  },
  props: {
    ellipsis: {
      type: Boolean,
      default: false
    },
    border: {
      type: Boolean,
      default: false
    }
  }
};
</script>
<style lang="less" scope>
.iu-nav-bar {
  position: relative;
  z-index: 1;
  line-height: 22px;
  text-align: center;
  background-color: #18182c;
  user-select: none;
  color: #fff;
  font-size: 16px;
}
.iu-hairline--bottom::after {
  position: absolute;
  box-sizing: border-box;
  content: " ";
  pointer-events: none;
  top: -50%;
  right: -50%;
  bottom: -50%;
  left: -50%;
  transform: scale(0.5);
  border-bottom: 1px solid #222;
}
.iu-nav-bar-content {
  position: relative;
  display: flex;
  align-items: center;
  height: 46px;
}
.iu-nav-bar-title {
  max-width: 60%;
  margin: 0 auto;
  font-weight: 500;
  font-size: 16px;
}
.iu-ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.iu-nav-bar-left {
  left: 0;
}
.iu-nav-bar-right {
  right: 0;
}
.iu-nav-bar-left,
.iu-nav-bar-right {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  cursor: pointer;
}
</style>
